<%@page import="java.util.*"%>
<%@page import="subject.*"%>
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>课程分页</title>
<script type="text/javascript" src="js/jquery-3.4.1.min.js"></script>
<script type="text/javascript">
	$(function() {
		$("input[name=p]").keydown(function(e) {
			//alert(e.keyCode);//13
			if (e.keyCode == 13) {
				location = "SubjectServlet?p=" + $(this).val();
			}
		}).blur(function() {
			location = "SubjectServlet?p=" + $(this).val();
		});
	});
</script>
</head>
<body>
	<table border="1" align="center" width="80%" cellpadding="0" cellspacing="0">
		<tr>
			<td>课程编号</td>
			<td>课程名</td>
			<td>学时</td>
			<td>年级</td>

		</tr>
		<c:forEach items="${LIST}" var="s">
		<tr>
			<td>${s.id}</td>
			<td>${s.subjectname}</td>
			<td>${s.classhour}</td>
			<td>${s.grade}</td>
		</tr>
		</c:forEach>

	</table>
	<p align="center">
		<a href="SubjectServlet?p=1">首页</a>
		<c:if test="${PAGE_NO>1}">
		<a href="SubjectServlet?p=${PAGE_NO-1}">上一页</a>
		</c:if>
		<input type="number" size="4" style="width: 30px" name="p" value="${PAGE_NO}" /> <span>${PAGE_NO}</span>
		<c:if test="${PAGE_NO<TotalPages}">
		<a href="SubjectServlet?p=${PAGE_NO+1}">下一页</a>
		</c:if>
		<a href="SubjectServlet?p=${TotalPages}">最后一页</a>
</body>
</html>